package com.gxa.service.impl.fwgl.jdgl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.gxa.mapper.fwgl.hlgl.ServiceMapper;
import com.gxa.mapper.fwgl.jdgl.ReceptionMapper;
import com.gxa.pojo.dto.fwgl.NormalInDto;
import com.gxa.pojo.entity.fwgl.TReception;
import com.gxa.pojo.entity.fwgl.TServicemanage;
import com.gxa.service.fwgl.jdgl.ReceptionService;
import com.gxa.utils.QueryResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ReceptionServiceImpl implements ReceptionService {

    @Resource
    private ReceptionMapper receptionMapper;
    @Override
    public QueryResult queryAll(NormalInDto normalInDto) {
        Page<TReception> page = PageHelper.startPage(normalInDto.getPage(),normalInDto.getLimit());
        List<TReception> receptionList = receptionMapper.queryAll(normalInDto);
        QueryResult queryResult = new QueryResult();
        queryResult.setCount(page.getTotal());
        queryResult.setData(receptionList);
        return queryResult;
    }

    @Override
    public void add(TReception tReception) {
    this.receptionMapper.insertReception(tReception);
    }

    @Override
    public void update(TReception tReception) {
   this.receptionMapper.updateReception(tReception);
    }

    @Override
    public void delete(int id) {
        this.receptionMapper.deleteService(id);

    }
}
